﻿using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Infrastucture;
using Infrastucture.Collections;

namespace TimeSplicerModule.DomainModels
{
    public class CategoryModel : DomainObject
    {
        private Guid _categoryGuid;
        private Guid _parentCategoryGuid;
        private string _name;
        private bool _isActive;
        private string _description;
        private bool _isProjectCategory;
        private bool _isBranchCategory;
        private bool _isTaskCategory;
        private bool _isTaskSubCategory;
        private bool _isGlobal;
        private CategoryModel _parentCategory;
        private List<CategoryModel> _categories;
        private List<TeamCategoryModel> _teamCategories;
        private ObservableCollection<TeamCategoryModel> _observableTeamCategories;


        public Guid CategoryGuid
        {
            get { return _categoryGuid; }
            set { SetProperty(ref _categoryGuid, value); }
        }
        public Guid ParentCategoryGuid
        {
            get { return _parentCategoryGuid; }
            set { SetProperty(ref _parentCategoryGuid, value); }
        }
        [Required]
        public string Name
        {
            get { return _name; }
            set { SetProperty(ref _name, value); }
        }
        public bool IsActive
        {
            get { return _isActive; }
            set { SetProperty(ref _isActive, value); }
        }
        public string Description
        {
            get { return _description; }
            set { SetProperty(ref _description, value); }
        }
        public bool IsProjectCategory
        {
            get { return _isProjectCategory; }
            set { SetProperty(ref _isProjectCategory, value); }
        }
        public bool IsBranchCategory
        {
            get { return _isBranchCategory; }
            set { SetProperty(ref _isBranchCategory, value); }
        }
        public bool IsTaskCategory
        {
            get { return _isTaskCategory; }
            set { SetProperty(ref _isTaskCategory, value); }
        }
        public bool IsTaskSubCategory
        {
            get { return _isTaskSubCategory; }
            set { SetProperty(ref _isTaskSubCategory, value); }
        }
        public bool IsGlobal
        {
            get { return _isGlobal; }
            set { SetProperty(ref _isGlobal, value); }
        }
        public CategoryModel ParentCategory
        {
            get { return _parentCategory; }
            set { SetProperty(ref _parentCategory, value); }
        }
        public List<CategoryModel> Categories
        {
            get { return _categories; }
            set { SetProperty(ref _categories, value); }
        }
        public List<TeamCategoryModel> TeamCategories
        {
            get { return _teamCategories; }
            set 
            { 
                SetProperty(ref _teamCategories, value);

                if (this.TeamCategories != null)
                    this.ObservableTeamCategories = this.TeamCategories.ToObservableCollection();
            }
        }
        public ObservableCollection<TeamCategoryModel> ObservableTeamCategories
        {
            get { return _observableTeamCategories; }
            set { SetProperty(ref _observableTeamCategories, value); }
        }
    }
}
